package cn.kevinking.ai.mcp.provider.configure;

import cn.kevinking.ai.mcp.provider.web.RequestBodyArgumentResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolverComposite;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;

/**
 * @author jinkw
 */
@Configuration
public class ArgumentResolverConfig {

    @Bean
    public HandlerMethodArgumentResolverComposite resolverComposite(RequestMappingHandlerAdapter adapter) {
        return new HandlerMethodArgumentResolverComposite().addResolvers(adapter.getArgumentResolvers());
    }

    @Bean
    public RequestBodyArgumentResolver argumentResolver(HandlerMethodArgumentResolverComposite resolverComposite) {
        return new RequestBodyArgumentResolver(resolverComposite);
    }
}
